<template>
  <view class="find">
    <u-navbar title="个人中心" :autoBack="true">
      <u-icon slot="left" name="list" />
    </u-navbar>
    <view style="height: 44px;margin-top: 16px;" />
    <Banner v-if="findData.list.length > 0" :list="findData.list" />
    <u-loading-page :loading="loading" />
  </view>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator"
import { FindService } from "@/api/find/findService"
import Banner from "./model/banner.vue"

@Component({
  components: {
    Banner
  }
})
export default class Find extends Vue {

  public findData = {
    list: []
  }

  public loading: boolean = false

  private created() {
    this.handleInit()
  }

  public handleInit = async () => {
    this.loading = true
    FindService.getPage({}).then(({ data }: any) => {
      data.blocks?.forEach((item: any) => {
        if (item?.blockCode === "HOMEPAGE_BANNER") {
          this.findData.list = item?.extInfo?.banners
        }
      })
    }).finally(() => this.loading = false)

    // const { data }: any = await FindService.getBall()
    // data?.map((item: any) => {
    //   if(item?.name.)
    // })


  }
}
</script>

<style lang="scss">
.find {
  padding: 0 16px;
}
</style>